from typing import List, Dict, Any

from baidubce.bce_client_configuration import BceClientConfiguration
from baidubce.auth.bce_credentials import BceCredentials
from baidubce.services.bts.bts_client import BtsClient
from baidubce.services.bts.model import ScanArgs


def get_table_storage() -> BtsClient:
    access_key_id = "access_key"
    secret_access_key = "secret_key"
    host = "https://bts.bd.baidubce.com"
    config = BceClientConfiguration(
        credentials=BceCredentials(
            access_key_id, secret_access_key
        ),
        endpoint=host,
    )
    return BtsClient(config)


table_client = get_table_storage()


if __name__ == "__main__":
    scan_args = ScanArgs()
    response = table_client.scan(b'flow_guardian', b'device_info', scan_args)
    new_list = [{cell.column: cell.value} for row in response.result for cell in row.cells]
    print(new_list)
